﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
using System.ServiceModel.Syndication;

namespace dasBlog.Storage
{
    [DataContract]
    public class EventEntry : IEntry<EventEntry>
    {
        [DataMember]
        public Moniker Id { get; set; }
        [DataMember]
        public DateTime Time { get; set; }
        [DataMember]
        public string Message { get; set; }
        [DataMember]
        public string Code { get; set; }

        public System.ServiceModel.Syndication.SyndicationItem ToSyndicationItem<Q>()
        {
            return new System.ServiceModel.Syndication.SyndicationItem
            {
                Title = SyndicationContent.CreatePlaintextContent(this.Message),
                PublishDate = this.Time,
                Summary = SyndicationContent.CreatePlaintextContent(this.Code)
            };
        }

        public bool IsAuthorized(System.IdentityModel.Claims.ClaimSet claim)
        {
            return true;
        }

        #region IExtensibleDataObject Members

        public ExtensionDataObject ExtensionData
        {
            get;
            set;
        }

        #endregion
    }

    public interface IEventStorageProvider : IStorageProvider<EventEntry>{}
}
